<?php
/**
 *
 *
 */
namespace Yz\modules\Generic;

class Controller_Add
    extends Controller_Edit
    implements \Yz_Controller_Interface
{


    /**
     *
     */
    protected function loadItem()
    {
        debug();
        $this->item = $this->model->selectItem();
        return $this;
    }



    /**
     *
     */
    protected function updateModel()
    {
        if (null === $this->error) {
            try {
                $this->model->addItem($this->item);
            } catch (\Yz_SQL_Exception_Unique $ex) {
                $this->error = $ex;
            }
        }
        return $this;
    }

}
